<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:insert="~{include :: header('评论详情')}" />
    <th:block th:insert="~{include :: select2-css}" />
</head>
<body class="hold-transition">
<div class="container-fluid mt-2 mb-2">
    <form id="form-comment-statu" class="form-horizontal"  th:object="${comment}">
        <input type="hidden" th:field="*{commentId}" name="commentId">
        <h4 class="form-header text-break h4" style="padding-left: 20px" th:text="'评论对象:'+${objName}">详细信息</h4>
        <hr>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">用户名:</label>
            <span class="col-sm-3 col-form-label" th:text="*{userName}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">手机号码:</label>
            <span class="col-sm-3 col-form-label" th:text="*{mobile}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">点赞:</label>
            <span class="col-sm-3 col-form-label" th:text="*{praiseCount}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">回复:</label>
            <span class="col-sm-3 col-form-label" th:text="*{replyCount}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">类型:</label>
            <span class="col-sm-3 col-form-label text-danger" th:text="*{typeId==1?'资讯':typeId==2?'课程':typeId==3?'直播':typeId==4?'章节':'未知'}+' (id='+*{otherId}+')'"></span>
            <label class="col-sm-2 text-sm-right col-form-label">状态:</label>
            <span class="col-sm-3 col-form-label" th:text="*{status==0?'未审核':status==1?'已通过':'未通过'}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">时间:</label>
            <span class="col-sm-4 col-form-label" th:text="${#strings.replace(comment.addTime,'T',' ')}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">评论内容:</label>
            <span class="col-sm-8 col-form-label" th:text="*{content}"></span>
        </div>
    </form>
</div>

<div class="row" th:if="${comment.status == 0}">
    <label class="col-sm-2"></label>
    <div class="col-sm-10">
        <button type="button" class="btn btn-sm btn-success" th:onclick="commenteStatus(1)"><i class="fa fa-check"></i>通 过</button>&nbsp;
        <button type="button" class="btn btn-sm btn-primary" th:onclick="commenteStatus(-1)"><i class="fa fa-reply-all"></i>驳 回 </button>
    </div>
</div>
<th:block th:insert="~{include :: footer}" />
<th:block th:insert="~{include :: select2-js}" />
<script>
    function commenteStatus(status) {
        var data = $("#form-comment-statu").serializeArray();
        data.push({"name": "status", "value": status});
        if (status === 1) {
            str = "确定审核通过操作吗"
        } else {
            str = "确定审核驳回操作吗"
        }
        $.modal.confirm(str, function () {
            $.operate.save("/comment/status.json", data);
        });
    }
</script>
</body>
</html>